---
title: Input
description: A native input element.

links:
  doc: https://base-ui.com/react/components/input#api-reference
---

<ComponentPreview name="p-input-1" />

## Installation

<CodeTabs>

<TabsList>
  <TabsTab value="cli">CLI</TabsTab>
  <TabsTab value="manual">Manual</TabsTab>
</TabsList>
<TabsPanel value="cli">

```bash
npx shadcn@latest add @coss/input
```

</TabsPanel>

<TabsPanel value="manual">

<Steps>

<Step>Install the following dependencies:</Step>

```bash
npm install @base-ui-components/react
```

<Step>Copy and paste the following code into your project.</Step>

<ComponentSource name="input" title="components/ui/input.tsx" />

<Step>Update the import paths to match your project setup.</Step>

</Steps>

</TabsPanel>

</CodeTabs>

## Usage

```tsx
import { Input } from "@/components/ui/input"
```

```tsx
<Input />
```

## Examples

For accessible labelling and validation, prefer using the `Field` component to wrap inputs, or the `FieldControl` component. See some [related examples](/ui/docs/components/field).

### Small Size

<ComponentPreview name="p-input-2" />

### Large Size

<ComponentPreview name="p-input-3" />

### Disabled

<ComponentPreview name="p-input-4" />

### File

<ComponentPreview name="p-input-5" />

### With Label

<ComponentPreview name="p-input-6" />

### With Button

<ComponentPreview name="p-input-7" />

### Form Integration

<ComponentPreview name="p-form-1" />

## Comparing with shadcn

Compared to shadcn/ui, our `Input` component includes size variants for better density control. shadcn/ui inputs have a fixed height of 36px, while our component offers flexible sizing with `sm` (28px), `default` (32px), and `lg` (36px) options.

So, if you want to preserve the original shadcn/ui input height (36px), you should use the `lg` size in coss ui.
